<?php
require_once('../../../../conf/config.php.inc');
require_once(SYBMAS_LIB_PATH.'/liblogin.php.inc');
require_once(SYBMAS_LAYOUT_PATH.'/layout.php.inc');
require_once(SYBMAS_LIB_PATH.'/libsybmas.php.inc');
require_once(SYBMAS_LAYOUT_PATH.'/menu.php.inc');
require_once('../../lib/libtablas.php.inc');
include_once('otorgarRevocar.php.inc');
verificar_inicio_sesion();	

if(array_key_exists('function',$_GET)){
	$parameters=$_GET;
}else if (array_key_exists('function',$_POST)){
	$parameters=$_POST;
}else{
	die('Se requiere especificar el nombre de la funcion a invocar');
}

$dbname=false;
foreach($parameters as $key=>$value){
	$$key=trim($value);
}
	
switch ($function){
	case 'getUsers':
		$data=getUsers($dbname);
		break;
	case 'getGroups':
		$data=getGroups($dbname);
		break;
	case 'getPrivileges':
		$data=getPrivileges($dbname,$tableowner,$tablename,$user);
		break;
	case 'getPrivilegesWithGrantOption':
		$data=getPrivilegesWithGrantOption($dbname,$tableowner,$tablename,$user);
		break;
	default:
		die("Funcion desconocida: $function ".$_SERVER['QUERY_STRING']);	
}	
echo $data;	

?>

